Kinetis SDK Demo Applications User Guide  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cmd_handle.c File Reference
#include <stdio.h>
#include <string.h>
#include "cmd_handle.h"
#include "char_handle.h"
#include "fsl_misc_utilities.h"

Macros

#define MAX_DELAY_STOP_STR
 
#define CB_SIZE
 
#define MAX_ARGS
 

Functions

static char * delete_char (char *buffer, char *p, int32_t *colp, int32_t *np, int32_t plen)
 
static int32_t readline (const char *const prompt)
 
static int parse_line (char *line, char *argv[])
 
static cmd_tbl_tfind_cmd (const char *cmd, cmd_tbl_t *table, int32_t table_len)
 
static int32_t run_command (const char *cmd, int32_t flag)
 Run command. More...
 
void cmd_handle_loop (void)
 Command handler function. More...
 

Variables

cmd_tbl_t sf_cmd_tbl [SPI_FLASH_FUNC_NUM]
 
char console_buffer [CB_SIZE]
 
static char erase_seq []
 
static char tab_seq []
 

Macro Definition Documentation

#define CB_SIZE
#define MAX_ARGS
#define MAX_DELAY_STOP_STR

Function Documentation

void cmd_handle_loop ( void  )
static char * delete_char ( char *  buffer,
char *  p,
int32_t *  colp,
int32_t *  np,
int32_t  plen 
)
static
static cmd_tbl_t* find_cmd ( const char *  cmd,
cmd_tbl_t table,
int32_t  table_len 
)
static
static int parse_line ( char *  line,
char *  argv[] 
)
static
static int32_t readline ( const char *const  prompt)
static
static int32_t run_command ( const char *  cmd,
int32_t  flag 
)
static

WARNING:

We must create a temporary copy of the command since the command we get may be the result from getenv(), which returns a pointer directly to the environment data, which may change magicly when the command we run creates or modifies environment variables (like "bootp" does).

Parameters
[in]cmdname string of command.
[in]flagnot used yet.
Returns
1 - command executed, repeatable 0 - command executed but not repeatable, interrupted commands are always considered not repeatable -1 - not executed (unrecognized, bootd recursion or too many args) (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is considered unrecognized)

Variable Documentation

char console_buffer[CB_SIZE]
char erase_seq[]
static
char tab_seq[]
static